/*
 * CustomPasswordBox.fx
 *
 * Created on 8.2.2010, 23:09:
 */
package com.gpsbuddy.components;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.text.Text;
import javafx.geometry.VPos;
import javafx.scene.layout.HBox;
import com.gpsbuddy.main.Enviroment;

/**
 * @author jonycus
 */
public class CustomPasswordBox extends CustomNode {

    public-init var env:Enviroment;

    public var label: String;
    public var text: String;

    var labelComp = Text {
                content: bind label;
            }
    var inputField = PasswordBox {
            password: bind text with inverse;
                }


    public var container = HBox {
                spacing: 10;
                nodeVPos: VPos.CENTER;
                content: [labelComp, inputField];
            }
    var content = Group {
                content: [container]
            }

    override protected function create(): Node {
        return content;
    }

    postinit {
        inputField.columns = (env.screenWidth - labelComp.layoutBounds.width - container.spacing)/12 as Integer;
    }

}
